package com.zlz.generate.util;

import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wb_zhulinzhong
 * @date 2021-04-19 20:50:26
 */
@Component
public class DataSourceCache {

    private final Map<String, SimpleDriverDataSource> map = new HashMap<>();

    private SimpleDriverDataSource used;

    public SimpleDriverDataSource getUsed() {
        return used;
    }

    public void setUsed(SimpleDriverDataSource use) {
        this.used = use;
    }

    public SimpleDriverDataSource get(String name){
        return this.map.get(name);
    }

    public void set(SimpleDriverDataSource dataSource, String name){
        this.map.put(name, dataSource);
    }
}
